// 请求,参数{url:'', data:{}, method:'POST'}
export const request = (options) => {
	return new Promise((resolve, reject) => {
		uni.request({
			url: options.url,
			method: options.method || 'GET',
			// header:{token: uni.getStorage('user') ? uni.getStorage('user').token : ''},
            // 后端需要的请求头
			header: {
				Authorization:`Bearer ${uni.getStorageSync('token')}` 
				Authorization: uni.getStorageSync('token')
			},
			data: options.data || {},
			success: res => {
				const data = res.data
				resolve(data)
			},
			fail: error => {
				reject(error)
			}
		})
	})
}